package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.model.mapper.VipMctInfoMapper;
import com.ttg.model.pojo.VipMctInfo;
import com.ttg.web.dao.VipMctInfoDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;


/**
 * @author zhangHongYuan
 * @description
 * @date 2023/6/8 11:19
 */
@Slf4j
@Service
public class VipMctInfoDaoImpl extends ServiceImpl<VipMctInfoMapper, VipMctInfo> implements VipMctInfoDao {


    @Override
    public VipMctInfo findMctInfoByMctAndDate(Integer mct, LocalDate date) {
        LambdaQueryWrapper<VipMctInfo> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(VipMctInfo::getMctNo,mct).eq(VipMctInfo::getSettingTime,date);
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public List<VipMctInfo> findMctInfoByVipIdAndLatelyDate(Long vipId, LocalDate date) {
        LambdaQueryWrapper<VipMctInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(VipMctInfo::getVipId,vipId).eq(VipMctInfo::getSettingTime,date);
        return list(wrapper);
    }
}
